#include "GameElement.h"

GameElement::GameElement():
    _pos_x(0),
    _pos_y(0),
    _direction_x(0),
    _direction_y(0),
    _ID(0),
    _alive(false),
    _face_direction(RIGHT)

{}

void GameElement::initialise(int pos_x, int pos_y, int direction_x, int direction_y, int ID)
{
    _pos_x = pos_x;
    _pos_y = pos_y;
    _direction_x = direction_x;
    _direction_y = direction_y;
    _ID = ID;
    _alive = true;
}

int GameElement::get_pos_x()
{
    return _pos_x;
}

int GameElement::get_pos_y()
{
    return _pos_y;
}

void GameElement::set_pos_x(int pos_x)
{
    _pos_x = pos_x;
}

void GameElement::set_pos_y(int pos_y)
{
    _pos_y = pos_y;
}

int GameElement::get_direction_x()
{
    return _direction_x;
}

int GameElement::get_direction_y()
{
    return _direction_y;
}

int GameElement::get_ID()
{
    return _ID;
}

bool GameElement::get_alive()
{
    return _alive;
}

void GameElement::set_alive(bool life_status)
{
    _alive = life_status;
}

int GameElement::get_face_direction()
{

    if ( _direction_x > 0 )  //face right
    {
        _face_direction = RIGHT;
    }

    else if ( _direction_x < 0 ) //face left
    {
        _face_direction = LEFT;
    }

    else if ( _direction_y < 0)  //face up
    {
        _face_direction = UP;
    }

    else if ( _direction_y > 0 ) //face down
    {
        _face_direction = DOWN;
    }

    return _face_direction;
}
